home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / RegionProjectileAtThing.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  2.6 KB  |  78 lines

  1. public class RegionProjectileAtThing extends Codex {
  2.    private static final int TIMER_ID_INACTIVE = 1;
  3.    private static final int TIMER_ID_MULTIPLE = 2;
  4.    private CodexThing _emitter;
  5.    private CodexThing _targetObject;
  6.    private String _templateName;
  7.    private int _numProjectiles;
  8.    private int _numTimesToFire;
  9.    private float _delayBetween;
  10.    private int _scatter;
  11.    private float _delayInactive;
  12.    // $FF: renamed from: i int
  13.    private int field_0;
  14.    private boolean bActive;
  15.    private float[] offset;
  16.    public static String[] _params = new String[]{"Emitter thing", "Target object", "Template to fire", "Number of projectiles;1", "Number of times to fire (0 is unlimited);0", "Delay in between;0.0", "Scatter;0", "Delay Inactive;5.0"};
  17.  
  18.    public void restore(int flags) {
  19.       this.field_0 = CodexSequence.RestoreInt();
  20.    }
  21.  
  22.    public void entered(int guid, int causeGUID, int captureID) {
  23.       if (!this.bActive) {
  24.          if (Codex.IsActorGuid(causeGUID)) {
  25.             if (this._numTimesToFire != 0) {
  26.                if (this.field_0 >= this._numTimesToFire) {
  27.                   return;
  28.                }
  29.  
  30.                this.FireProjectile();
  31.                ++this.field_0;
  32.             } else {
  33.                this.FireProjectile();
  34.             }
  35.  
  36.          }
  37.       }
  38.    }
  39.  
  40.    public RegionProjectileAtThing(CodexThing emitter, CodexThing targetObject, String templateName, int numProjectiles, int numTimesToFire, float delayBetween, int scatter, float delayInactive) {
  41.       this._emitter = new CodexThing(((Codex)emitter).GetGUID());
  42.       this._targetObject = new CodexThing(((Codex)targetObject).GetGUID());
  43.       this._templateName = templateName;
  44.       this._numProjectiles = numProjectiles;
  45.       this._numTimesToFire = numTimesToFire;
  46.       this._delayBetween = delayBetween;
  47.       this._scatter = scatter;
  48.       this._delayInactive = delayInactive;
  49.       this.offset = new float[3];
  50.       this.offset[0] = 0.0F;
  51.       this.offset[1] = 0.0F;
  52.       this.offset[2] = 0.0F;
  53.    }
  54.  
  55.    public void save(int flags) {
  56.       CodexSequence.SaveInt(this.field_0);
  57.    }
  58.  
  59.    public void timer(int timerID, float arg0, float arg1, float arg2, float arg3) {
  60.       if (timerID == 1) {
  61.          this.bActive = false;
  62.       } else {
  63.          this._emitter.FireProjectileAtThing(this._templateName, (int)arg0, this.offset);
  64.          if ((int)arg1 + 1 < this._numProjectiles) {
  65.             ((Codex)this).SetTimer(this._delayBetween, 2, (float)((int)arg0), (float)((int)arg1 + 1));
  66.          }
  67.       }
  68.  
  69.    }
  70.  
  71.    public void FireProjectile() {
  72.       this._emitter.FireProjectileAtThing(this._templateName, this._targetObject.GetGUID(), this.offset);
  73.       this.bActive = true;
  74.       ((Codex)this).SetTimer(this._delayInactive, 1);
  75.       ((Codex)this).SetTimer(this._delayBetween, 2, (float)this._targetObject.GetGUID(), 1.0F);
  76.    }
  77. }
  78.